package com.lechuang.cunpinke.utils;


import com.lechuang.cunpinke.bean.LogBean;
import com.lechuang.cunpinke.manager.LogManager;
import com.tencent.bugly.crashreport.BuglyLog;


public class LogUtils {
    private static final boolean LOG_SWITCH = true;

    public static void v(String tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.v(tag, msg);
    }

    public static void v(Object tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.v(tag.getClass().getSimpleName(), msg);
    }

    public static void i(String tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.i(tag, msg);
    }

    public static void i(Object tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.i(tag.getClass().getSimpleName(), msg);
    }

    public static void d(String tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.d(tag, msg);
    }

    public static void d(Object tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.d(tag.getClass().getSimpleName(), msg);
    }

    public static void w(String tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.w(tag, msg);
    }

    public static void w(Object tag, String msg) {
        if (LOG_SWITCH)
            BuglyLog.w(tag.getClass().getSimpleName(), msg);
    }

    public static void e(String tag, Object obj) {
        if (LOG_SWITCH) {
            BuglyLog.e(tag, obj + "");
        }
        LogBean log = new LogBean();
        log.tag = tag;
        log.msg = obj + "";
        log.time = System.currentTimeMillis();
        LogManager.getInstance().put(log);
    }

    public static void e(Object tag, Object obj) {
        if (LOG_SWITCH) {
            BuglyLog.e(tag.getClass().getSimpleName(), obj + "");
        }
        LogBean log = new LogBean();
        log.tag = tag.getClass().getSimpleName();
        log.msg = obj + "";
        log.time = System.currentTimeMillis();
        LogManager.getInstance().put(log);
    }

}
